package com.chang.impl;

import com.chang.dao.Aggregate;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @program: StudentIterator
 * @description: 班级
 * @author: chang
 * @create: 2024-12-30 11h
 **/

public class ClassRoom implements Aggregate {
    private List<Student> list= new ArrayList();

    public void  add(Student student){
        list.add(student);
    }
    public int size(){
        return list.size();
    }

    public Student get(int index){
        return list.get(index);
    }
    @Override
    public Iterator createIterator() {
        return new ClassRoomIterator(this);
    }
}
